﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
    <!-- Fill Brushes -->

    <LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFF" Offset="0.0"/>
                <GradientStop Color="#CCC" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="HorizontalNormalBrush" StartPoint="0,0" EndPoint="1,0">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFF" Offset="0.0"/>
                <GradientStop Color="#CCC" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFF" Offset="0.0"/>
                <GradientStop Color="#EEE" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFF" Offset="0.0"/>
                <GradientStop Color="#EEE" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFF" Offset="0.0"/>
                <GradientStop Color="#AAA" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#BBB" Offset="0.0"/>
                <GradientStop Color="#EEE" Offset="0.1"/>
                <GradientStop Color="#EEE" Offset="0.9"/>
                <GradientStop Color="#FFF" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />

    <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />

    <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FFF" />

    <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#DDD" />

    <!-- Border Brushes -->

    <LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#CCC" Offset="0.0"/>
                <GradientStop Color="#444" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#CCC" Offset="0.0"/>
                <GradientStop Color="#444" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#777" Offset="0.0"/>
                <GradientStop Color="#000" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#444" Offset="0.0"/>
                <GradientStop Color="#888" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />

    <SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />

    <SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />

    <!-- Miscellaneous Brushes -->
    <SolidColorBrush x:Key="GlyphBrush" Color="#444" />

    <SolidColorBrush x:Key="LightColorBrush" Color="#DDD" />

    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="10" />
            </Grid.ColumnDefinitions>
            <Border
      x:Name="Border" 
      Grid.ColumnSpan="2"
      CornerRadius="0"
      Background="#FFF1F3F8"
      BorderBrush="#FF6B6E6F"
      BorderThickness="1" />
            <Border x:Name="ArrowBorder"
      Grid.Column="0"
      CornerRadius="0,0,0,0" 
      Margin="1" 
      Background="#FFF1F3F8" 
      BorderBrush="#FFE5C365"
      BorderThickness="0,0,0,0" />
            <Path 
      x:Name="Arrow"
      Grid.Column="1"  
                Margin="-3,0,0,0"
      Fill="{StaticResource GlyphBrush}"
      HorizontalAlignment="Center"
      VerticalAlignment="Center"
      Data="M 0 0 L 4 4 L 8 0 Z"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="ToggleButton.IsMouseOver" Value="true">
                <Setter TargetName="Border" Property="Background" Value="#FFFFEFBB" />
                <Setter TargetName="Border" Property="BorderBrush" Value="#FFE5C365"></Setter>
                <Setter  Property="BorderBrush" Value="#FFE5C365" />
                <Setter TargetName="ArrowBorder" Property="BorderThickness" Value="0,0,1,0"></Setter>

            </Trigger>            
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
        <Border x:Name="PART_ContentHost" Focusable="False" Width="190" Background="{TemplateBinding Background}" />
    </ControlTemplate>

    <Style x:Key="CodeCComboBox" TargetType="ComboBox">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="MinHeight" Value="18"/>
        <Setter Property="Height" Value="18"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <ToggleButton 
            Name="ToggleButton" 
            Template="{StaticResource ComboBoxToggleButton}" 
            Grid.Column="2" 
            Focusable="false"
            IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
            ClickMode="Press">
                        </ToggleButton>
                        <ContentPresenter
            Name="ContentSite"
            IsHitTestVisible="False" 
            Content="{TemplateBinding SelectionBoxItem}"
            ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
            ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
            Margin="3,3,3,3"
            VerticalAlignment="Center"
            HorizontalAlignment="Left" />
                        <TextBox x:Name="PART_EditableTextBox"
            Style="{x:Null}" 
            Template="{StaticResource ComboBoxTextBox}" 
            HorizontalAlignment="Left" 
            VerticalAlignment="Center" 
            Margin="3,1,13,3"
            Focusable="True" 
            Background="Transparent"
            Visibility="Hidden"
            IsReadOnly="{TemplateBinding IsReadOnly}"/>
                        <Popup 
            Name="Popup"
            Placement="Bottom"
            IsOpen="{TemplateBinding IsDropDownOpen}"
            AllowsTransparency="True" 
            Focusable="False"
            PopupAnimation="Slide">
                            <Grid 
              Name="DropDown"
              SnapsToDevicePixels="True"                
              MinWidth="{TemplateBinding ActualWidth}"
              MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border 
                x:Name="DropDownBorder"
                Background="#FFD5DCE8"

                BorderThickness="1"
                BorderBrush="{StaticResource SolidBorderBrush}"/>
                                <ScrollViewer Margin="0" SnapsToDevicePixels="True">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
                            <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="0"/>
                            <Setter TargetName="DropDownBorder" Property="Margin" Value="0,1,0,0"/>
                        </Trigger>
                        <Trigger Property="IsEditable"
               Value="true">
                            <Setter Property="IsTabStop" Value="false"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility"    Value="Visible"/>
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
        </Style.Triggers>
    </Style>


    <Style x:Key="checkboxLeftSideText" TargetType="{x:Type CheckBox}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="FocusVisualStyle" 
            Value="{DynamicResource CheckBoxFocusVisual}"/>
        <Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
        <Setter Property="BorderBrush" 
            Value="{DynamicResource NormalBorderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">

                    <DockPanel 
          HorizontalAlignment="Stretch" 
          VerticalAlignment="Top" 
          Width="Auto" 
          LastChildFill="True">

                        <Microsoft_Windows_Themes:BulletChrome 
            DockPanel.Dock="Right" 
            Margin="4,0,0,0"
            Background="{TemplateBinding Background}" 
            BorderBrush="{TemplateBinding BorderBrush}" 
            IsChecked="{TemplateBinding IsChecked}" 
            RenderMouseOver="{TemplateBinding IsMouseOver}" 
            RenderPressed="{TemplateBinding IsPressed}" 
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Center" 
            Width="Auto" 
            Height="Auto"/>

                        <ContentPresenter 
            Content="{TemplateBinding Content}" 
            RecognizesAccessKey="True" 
            Height="Auto" 
            HorizontalAlignment="Left" />

                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- The IconButtonStyle -->
    <Style x:Key="IconButtonStyle"
               TargetType="{x:Type Button}">
        <!-- set some default values -->
        <Setter Property="Background"
                    Value="Transparent" />
        <Setter Property="BorderBrush"
                    Value="Transparent" />
        <!-- set the visual tree of the control -->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <!-- here come the actual sub-controls -->
                    <Border x:Name="border"
                                Height="{TemplateBinding Height}"
                                Width="{TemplateBinding Width}"
                                SnapsToDevicePixels="True"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="1"
                                Padding="0"
                                CornerRadius="0">
                        <Border x:Name="innerBorder"
                                    SnapsToDevicePixels="True"
                                    BorderThickness="1"
                                    Padding="0"
                                    CornerRadius="0">
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  RecognizesAccessKey="True"
                                                  Margin="4,4,0,0">
                                <ContentPresenter.Effect>
                                    <!-- give the content a bit of shadow -->
                                    <DropShadowEffect x:Name="shadow"
                                                          ShadowDepth="0"
                                                          Opacity="0"
                                                          BlurRadius="0" />
                                </ContentPresenter.Effect>
                                <ContentPresenter.RenderTransform>
                                    <!-- push the content a bit to the left and the top -->
                                    <TranslateTransform x:Name="translation"
                                                            X="-1"
                                                            Y="-1" />
                                </ContentPresenter.RenderTransform>
                            </ContentPresenter>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!-- 
                                the triggers define the reactions to various state
                                changes
                            -->
                        <Trigger Property="IsPressed"
                                     Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0"
                                                             To="0"
                                                             Storyboard.TargetName="shadow"
                                                             Storyboard.TargetProperty="(DropShadowEffect.ShadowDepth)" />
                                        <DoubleAnimation Duration="0:0:0"
                                                             To="0"
                                                             Storyboard.TargetName="translation"
                                                             Storyboard.TargetProperty="(TranslateTransform.X)" />
                                        <DoubleAnimation Duration="0:0:0"
                                                             To="0"
                                                             Storyboard.TargetName="translation"
                                                             Storyboard.TargetProperty="(TranslateTransform.Y)" />
                                        <ColorAnimation Duration="0:0:0"
                    Storyboard.TargetName="border"
                    Storyboard.TargetProperty="Background.Color" To="#FFFFEFBB" />
                                        <ColorAnimation Duration="0:0:0"
                    Storyboard.TargetName="innerBorder"
                    Storyboard.TargetProperty="BorderBrush.Color" To="#FFE5C365" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0"
                                                             To="1"
                                                             Storyboard.TargetName="shadow"
                                                             Storyboard.TargetProperty="(DropShadowEffect.ShadowDepth)" />
                                        <DoubleAnimation Duration="0:0:0"
                                                             To="-1"
                                                             Storyboard.TargetName="translation"
                                                             Storyboard.TargetProperty="(TranslateTransform.X)" />
                                        <DoubleAnimation Duration="0:0:0"
                                                             To="-1"
                                                             Storyboard.TargetName="translation"
                                                             Storyboard.TargetProperty="(TranslateTransform.Y)" />
                                        <ColorAnimation Duration="0:0:0"
                    Storyboard.TargetName="border"
                    Storyboard.TargetProperty="Background.Color" To="Transparent" />
                                        <ColorAnimation Duration="0:0:0"
                    Storyboard.TargetName="innerBorder"
                    Storyboard.TargetProperty="BorderBrush.Color" To="Transparent" />
                                    </Storyboard>

                                </BeginStoryboard>

                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                     Value="true">
                            <Setter TargetName="innerBorder"
                                        Property="BorderBrush"
                                        Value="#FFE5C365" />
                            <Setter Property="Background"
                                        Value="#FFFFEFBB" />
                        </Trigger>                     
                        <Trigger Property="IsKeyboardFocused"
                                     Value="true">
                            <Setter TargetName="innerBorder"
                                        Property="BorderBrush"
                                        Value="#FFE5C365" />
                            <Setter Property="Background"
                                        Value="#FFFFEFBB" />
                        </Trigger>

                        <!-- when the control is disabled, just let the background shine through -->
                        <Trigger Property="IsEnabled"
                                     Value="false">
                            <Setter Property="Opacity"
                                        Value="0.3" />
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>